//
//  UEFlont+Extension.swift
//  Extensions
//
//  Created by gupengling on 2021/6/5.
//  Copyright © 2021 gupengling. All rights reserved.
//

import UIKit

public extension WDExtension where Base: UIFont {
    var fit:UIFont {
        base.withSize(base.pointSize + UIFont.ue_fontFitSizeRatio)
        return base
    }
    func fit(_ size: CGFloat) -> UIFont {
        base.withSize(base.pointSize + size)
        return base
    }
}

public extension UIFont {
    /// 此方法需要在App启动时 运行 设置，如果需要更高级的管理，可自行扩展
    ///  比如 .iPad UIFont.cd_fontFitSizeRatio = fitSizeiPad
    static var ue_fontFitSizeRatio: CGFloat = 0
    func ue_fit(_ size: CGFloat = UIFont.ue_fontFitSizeRatio) -> UIFont {
        return self.withSize(self.pointSize + size)
    }

    static func ue_PingFangSCRegular(_ fontSize: CGFloat) -> UIFont {
        return UIFont.init(name: "PingFangSC-Regular", size: fontSize)!
    }
    static  func ue_PingFangSCLight(_ fontSize: CGFloat) -> UIFont {
        return UIFont.init(name: "PingFangSC-Light", size: fontSize)!
    }
    static  func ue_PingFangSCThin(_ fontSize: CGFloat) -> UIFont {
        return UIFont.init(name: "PingFangSC-Thin", size: fontSize)!
    }
    static  func ue_PingFangSCMeaium(_ fontSize: CGFloat) -> UIFont {
        return UIFont.init(name: "PingFangSC-Medium", size: fontSize)!
    }
    static  func ue_SFNSDisplay(_ fontSize: CGFloat) -> UIFont {
        return UIFont.init(name: "SFNSDisplay", size: fontSize)!
    }
    static  func ue_DINProMedium(_ fontSize: CGFloat) -> UIFont {
        return UIFont.init(name: "DINPro-Medium", size: fontSize)!
    }
}
